<?php
class pageComponents extends sfComponents
{
  public function executeLanguages()
  {
    $languages = LanguagePeer::doSelect(new Criteria());
    
    $uri = sfRouting::getInstance()->getCurrentInternalUri();
    
    foreach ($languages as $language)
    {
      $lang = myTools::langFromCulture($language->getCulture());
      
      // if lang parameter is present
      if(preg_match('/lang=/', $uri))
      {
        $uris[$language->getCulture()] = eregi_replace('lang=[a-z]{2}', 'lang='.$lang, $uri);
      }
      else
      {
        $param = preg_match('/\?/', $uri) ? '&lang='.$lang : '?lang='.$lang;
        $uris[$language->getCulture()] = $uri.$param;
      }
    }
  }
  
  public function executeNavigation()
  {
  
  }
}
